<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>模板管理-计划管理信息列表</title>
    <script src="/scripts/boot.js"></script>
    <style>
        html,body{
            margin:0;padding: 0;border:0;width:100%;height:100%;overflow:hidden;
        }
        body{
            background: #ffffff!important;
            padding:20px;
        }
    </style>
</head>
<body>
<div class="title-list mb-20"><span class="title-listbg"></span><span>模板信息列表</span></div>
<div id="qForm"  class="mini-toolbar1" style="border-bottom:0;padding:0px;">
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">
                <div class="mb-20 position-rel">
                    <span class="search-title search-ml20">业务类型</span><input id = "affiliatedCompanyId" name="affiliatedCompanyId" class="mini-textbox search-200px"   value="">
                    <span class="search-title search-ml60">模板名称</span><input id = "name" name="name" class="mini-textbox search-200px"   value="">
                    <a class="add-botton search-ml60" onclick="list.search()">查询</a>
                    <a class="resetting-btn search-ml20" onclick="list.reset()">重置</a>
                    <div class="position-abs">
                        <a class="add-botton"  onclick="list.addOrEdit('new')"><span class="add-bg"></span>新增</a>
                        <!--<a class="delall-botton search-ml20" onclick="delAll()">批量删除</a>-->
                    </div>
                </div>
            </td>
        </tr>
    </table>
</div>
<div class="mini-fit">
    <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;"  url="/item/listByPage" sizeList="[5,10,20,50]" pageSize="20"  idField="user_id" multiSelect="true">
        <div property="columns">
            <!--<div type="checkcolumn" headerAlign="center" align="center"></div>-->
            <div type="indexcolumn" headerAlign="center" align="center">序号</div>
            <div field="tSysNation.fullName" width="120" headerAlign="center" allowSort="true">业务类型</div>
            <div field="affiliatedCompanyId" width="120" headerAlign="center" allowSort="true">模板名称</div>
            <div field="name" width="120" headerAlign="center" allowSort="true">模板</div>
            <div field="abbreviation" width="120" headerAlign="center" allowSort="true">创建人</div>
            <div field="itemStartDate" width="120" headerAlign="center" allowSort="true">创建时间</div>
            <div field="itemEndDate" width="120" headerAlign="center" allowSort="true">审批状态</div>
            <div name="action" width="200" headerAlign="center" align="center">操作</div>
        </div>
    </div>
</div>
<script type="text/javascript">
    //list.init();
    var grid;
    var list = {
        //页面初始化
        init: function() {
            mini.parse();
            grid = mini.get("datagrid1");
            grid.load();
            grid.on("drawcell", function (e) {
                var column = e.column;
                var record = e.record;
                if (column.name == "action") {
                    e.cellHtml = '<a class="check-botton btn-bd" href="javascript:list.view()">点击下载</a>';
                }
            })
        },
        //    点击下载
        addOrEdit: function (opt) {
            mini.open({
                url: "/templet/planTemplet/new.html",
                title: (opt=="edit"?"编辑":"新增")+"项目信息", width: 1100, height: 500,
                onload: function () {
                    if(opt=="edit"){
                        var row = grid.getSelected();
                        var data = {"id": row.id,"state":opt};
                    }else{
                        var data = {"state":opt};
                    }
                    var iframe = this.getIFrameEl();
                    iframe.contentWindow.view.SetData(data);
                },
                ondestroy: function (action) {
                    grid.reload();
                }
            });
        },

        //    查询
        search: function () {
            var data = {
                "name": mini.get("name").getValue(),
                "affiliatedCompanyId": mini.get("affiliatedCompanyId").getValue(),
//            "provinceId": mini.get("provinceCombo").getValue() ? mini.get("provinceCombo").getValue() : 0,
                "cityId": mini.get("cityCombo").getValue(),
//            "regionId": mini.get("regionCombo").getValue() ? mini.get("regionCombo").getValue() : 0,
            };
            grid.load(data);
        },
        //重置
        reset:function(){
            var form = new mini.Form("qForm");
            form.reset();
            grid.load()
        }
    };
    list.init();
</script>
</body>
</html>